<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.b1 {
				background-color: orange;
			}

			.b2 {
				background-color: cadetblue;
			}
		</style>
	</head>
	<!-- style="background-color: orange;" -->
	<!-- class="b2" -->
	<body class="b1">
		<button>样式属性</button>
		<script type="text/javascript">
			var flag = false;
			var b = document.querySelector('button');
			b.onclick = function() {
				var body = document.querySelector('body');
				// body.style.backgroundColor = 'orange';
				if (flag) {
					body.className = 'b1';
					flag = false;
				} else {
					body.className = 'b2';
					flag = true;
				}
			}
		</script>
	</body>
</html>
